const Service = require('../../../core/service/ApiService');

class DeviceService extends Service {

    //获取所有设备
    async getAllDevice() {
        return this.service.miniapp.device.dao.getAllDevice();
    }

    //获取设备
    async getDevice(status) {
        return  this.service.miniapp.device.dao.getDevice(status);
    }

    //添加设备
    async addDevice(info) {
        info.status = this.constant.DEVICE_STATUS.ENABLE;
        await this.service.miniapp.device.dao.addDevice(info);
    }

    //获取设备具体信息
    async getDetails(device_id) {
        return this.service.miniapp.device.dao.getDetails(device_id);
    }

    //搜索设备
    async searchDevice(name) {
        return this.service.miniapp.device.dao.searchDevice(name);
    }
}

module.exports = DeviceService;
